package educationTool.model;

import java.util.Date;

/**
 * Pair is the class which creates objects of type Pair. Every object consists
 * of String namePair, String type, String auditorium, String group, Date
 * dateBegin, Date dateEnd
 * 
 * @author Ann
 */
public class Pair {

	private String namePair;
	private String type;
	private String auditorium;
	private String group;
	private Date dateBegin;
	private Date dateEnd;

	public String getNamePair() {
		return namePair;
	}

	public void setNamePair(String namePair) {
		this.namePair = namePair;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getAuditorium() {
		return auditorium;
	}

	public void setAuditorium(String auditorium) {
		this.auditorium = auditorium;
	}

	public String getGroup() {
		return group;
	}

	public void setGroup(String group) {
		this.group = group;
	}

	public Date getDateBegin() {
		return dateBegin;
	}

	public void setDateBegin(Date dateBegin) {
		this.dateBegin = dateBegin;
	}

	public Date getDateEnd() {
		return dateEnd;
	}

	public void setDateEnd(Date dateEnd) {
		this.dateEnd = dateEnd;
	}

	@SuppressWarnings("deprecation")
	@Override
	public String toString() {
		return new String("Name: " + namePair + "\n" + "Type: " + type + "\n"
				+ "Auditorium: " + auditorium + "\n" + "Group: " + group + "\n"
				+ "Time begin" + dateBegin.getHours() + ":"
				+ dateBegin.getMinutes() + "\n" + "");
	}
	
	
	@Override
	public boolean equals(Object obj) {
		if (obj == this)
			return true;

		if (obj == null)
			return false;

		if (!(getClass() == obj.getClass()))
			return false;
		else {
			Pair pair = (Pair) obj;
			return  pair.getNamePair().equals(this.getNamePair())
					&& pair.getType().equals(this.getType())
					&& pair.getAuditorium().equals(this.getAuditorium())
					&& pair.getGroup().equals(this.getGroup())
					&& pair.getDateBegin().equals(this.getDateBegin())
					&& pair.getDateEnd().equals(this.getDateEnd());				
		}
	}
	
	@Override
	public int hashCode(){
		int hash = 17;
		hash = hash * 37  + (namePair == null ? 0 : namePair.hashCode());
		hash = hash * 37  + (type == null ? 0 : type.hashCode());
		hash = hash * 37  + (auditorium == null ? 0 : auditorium.hashCode());
		hash = hash * 37  + (group == null ? 0 : group.hashCode());
		hash = hash * 37  + (dateBegin == null ? 0 : dateBegin.hashCode());
		hash = hash * 37  + (dateEnd == null ? 0 : dateEnd.hashCode());
		return hash;		
	}
}